package com.zlf.mapper;

import com.zlf.po.Point;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface PointMapper {
    @Update("update point set value=(select sum(state) from pointtransaction where id=#{userId} AND state>0) where id=#{userId}")
    void updatePoint(String userId);

    @Select("select * from point where id=#{userid}")
    Point selectById(String userId);
    @Insert("insert into point (id, value, create_time) values (#{id},#{value},#{createTime})")
    Integer insert(Point point);
}
